#include "MainFrame/MenuBar/FiltersMenuList.h"
#include <QEvent>

#include "MainFrame/MenuBar/Dialogs/BlurDialog.h"

FiltersMenuList::FiltersMenuList(const QString &title, QWidget *parent) :
    MenuListBase(title, parent),
    m_pBlurAction(nullptr),
    m_pEnhanceAction(nullptr),
    m_pDistortsAction(nullptr),
    m_pLightAndShadowAction(nullptr),
    m_pNoiseAction(nullptr),
    m_pEdgeDetectAction(nullptr),
    m_pGenericAction(nullptr),
    m_pArtisticAction(nullptr),
    m_pMapAction(nullptr),
    m_pRenderAction(nullptr),
    m_pWebAction(nullptr),
    m_pAnimationAction(nullptr)
{
    m_pBlurAction = addOneAction("Blur", this);
    m_pEnhanceAction = addOneAction("Enhance", this);
    m_pDistortsAction = addOneAction("Distorts", this);
    m_pLightAndShadowAction = addOneAction("Light and Shadow", this);
    m_pNoiseAction = addOneAction("Noise", this);
    m_pEdgeDetectAction = addOneAction("Edge Detect", this);
    m_pGenericAction = addOneAction("Generic", this);
    m_pArtisticAction = addOneAction("Artistic", this);
    m_pMapAction = addOneAction("Map", this);
    m_pRenderAction = addOneAction("Render", this);
    m_pWebAction = addOneAction("Web", this);
    m_pAnimationAction = addOneAction("Animation", this);

    connect(m_pBlurAction, SIGNAL(triggered()), this, SLOT(blurSlot()));
    connect(m_pEnhanceAction, SIGNAL(triggered()), this, SLOT(enhanceSlot()));
    connect(m_pDistortsAction, SIGNAL(triggered()), this, SLOT(distortsSlot()));
    connect(m_pLightAndShadowAction, SIGNAL(triggered()), this, SLOT(lightAndShadowSlot()));
    connect(m_pNoiseAction, SIGNAL(triggered()), this, SLOT(noiseSlot()));
    connect(m_pEdgeDetectAction, SIGNAL(triggered()), this, SLOT(edgeDetectSlot()));
    connect(m_pGenericAction, SIGNAL(triggered()), this, SLOT(genericSlot()));
    connect(m_pArtisticAction, SIGNAL(triggered()), this, SLOT(artisticSlot()));
    connect(m_pMapAction, SIGNAL(triggered()), this, SLOT(mapSlot()));
    connect(m_pRenderAction, SIGNAL(triggered()), this, SLOT(renderSlot()));
    connect(m_pWebAction, SIGNAL(triggered()), this, SLOT(webSlot()));
    connect(m_pAnimationAction, SIGNAL(triggered()), this, SLOT(animationSlot()));
}

FiltersMenuList::~FiltersMenuList()
{

}

void FiltersMenuList::changeEvent(QEvent *event)
{
    QWidget::changeEvent(event);
    switch (event->type())
    {
    case QEvent::LanguageChange:
        initTrans();
        break;
    default:
        break;
    }
}

void FiltersMenuList::initTrans()
{
    m_pBlurAction->setText(tr("Blur"));
    m_pEnhanceAction->setText(tr("Enhance"));
    m_pDistortsAction->setText(tr("Distorts"));
    m_pLightAndShadowAction->setText(tr("Light and Shadow"));
    m_pNoiseAction->setText(tr("Noise"));
    m_pEdgeDetectAction->setText(tr("Edge Detect"));
    m_pGenericAction->setText(tr("Generic"));
    m_pArtisticAction->setText(tr("Artistic"));
    m_pMapAction->setText(tr("Map"));
    m_pRenderAction->setText(tr("Render"));
    m_pWebAction->setText(tr("Web"));
    m_pAnimationAction->setText(tr("Animation"));
}

void FiltersMenuList::blurSlot()
{
    BlurDialog* blurdialog = new BlurDialog(this);
    blurdialog->show();
}

void FiltersMenuList::enhanceSlot()
{

}

void FiltersMenuList::distortsSlot()
{

}

void FiltersMenuList::lightAndShadowSlot()
{

}

void FiltersMenuList::noiseSlot()
{

}

void FiltersMenuList::edgeDetectSlot()
{

}

void FiltersMenuList::genericSlot()
{

}

void FiltersMenuList::artisticSlot()
{

}

void FiltersMenuList::mapSlot()
{

}

void FiltersMenuList::renderSlot()
{

}

void FiltersMenuList::webSlot()
{

}

void FiltersMenuList::animationSlot()
{

}
